package com.letoken.platform.repo.sss.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.letoken.platform.repo.sss.po.UserOtcDetail;
import com.letoken.platform.repo.sss.po.UserOtcTransactionRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2024-09-05
 */
public interface UserOtcDetailMapper extends BaseMapper<UserOtcDetail> {


    @Select({"<script>",
            "select uod.type,\n" +
                    "       uod.price,\n" +
                    "       uod.quantity,\n" +
                    "       uod.sum,\n" +
                    "       uod.status,\n" +
                    "       uoi.user,\n" +
                    "       uod.create_time\n" +
                    "from user_otc_detail uod\n" +
                    "         inner join user_otc_info uoi on uod.otc_id = uoi.id\n" +
                    "<where>" +
                    "   <if test='null != status'> " +
                    "           uod.status = #{status}" +
                    "   </if>" +
                    "</where>" +
                    "order by uod.create_time desc",
            "</script>"})
    Page<UserOtcTransactionRecord> page(@Param("page") Page<?> page,@Param("status") Integer status);


}
